﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace MVC2_Test.Models
{
    [Table(Name = "Item")]
    public class Item
    {
        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int ItemID { get; set; }

        [Column]
        public string Title { get; set; }

        [Column]
        public string Description { get; set; }

        [Column]
        public DateTime AuctionEndDate { get; set; }

        [Association(OtherKey = "ItemID")]
        private EntitySet<Bid> _bids = new EntitySet<Bid>();
        public IList<Bid> Bids { get { return _bids.ToList().AsReadOnly(); } }

    }
}